<?php

class Domain51_Service_Delicious_Tags_Bundles
{
    private $_connection = null;
    
    public function __construct(Domain51_Util_Service_Connection $connection) {
        $this->_connection = $connection;
    }
    
    /**
     * @todo Fix by returning a straight array once del.icio.us starts working
     */
    public function all() {
        $uri = 'tags/bundles/all';
        $responseXml = $this->_connection->doRequest($uri);
        return $responseXml;
    }
    
    public function set($bundle, $tags) {
        $params = array(
            'bundle=' . urlencode($bundle),
            'tags=' . urlencode($tags)
        );
        $uri = 'tags/bundles/set?' . implode('&', $params);
        var_dump($uri);
        $responseXml = $this->_connection->doRequest($uri);
        return ((string)$responseXml == 'ok');
    }
    
    public function delete($bundle) {
        $params = 'bundle=' . urlencode($bundle);
        $uri = 'tags/bundles/delete?' . $params;
        $responseXml = $this->_connection->doRequest($uri);
        return ((string)$responseXml == 'ok');
    }
}